<template>
	<view class="empty" v-if="flag">
		<image :src="icon" mode=""></image>
		<text>{{title}}</text>
		<button @click="to(datas)" class="eb" :style="'background-color:'+ bcolor" size="mini"
			type="primary">{{butName}}</button>
	</view>
</template>

<script>
	export default {
		name: 'cf-empty',
		emits: ['click'],
		props: {
			// 是否显示
			flag: {
				type: Boolean,
				default: true,
			},
			//图标
			icon: {
				type: String,
				default: '',
			},
			//提示
			title: {
				type: String,
				default: '暂无数据,快去下单吧!',
			},
			//按钮名称
			butName: {
				type: String,
				default: '去逛逛',
			},
			//跳转数据
			datas: {
				type: String,
				default: '',
			},
			//按钮背景色
			bcolor: {
				type: String,
				default: '',
			},

		},
		data() {
			return {}
		},
		//事件监听
		watch: {},
		onLoad() {
			console.log(this.width)
		},
		methods: {
			to(datas) {
				console.log("11", datas)
				this.$emit('click', datas);
			}

		}
	}
</script>


<style lang="scss">
	.empty {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		color: #adadad;
		height: 666px;
	}

	.eb {
		margin-top: 10px;
	}

	image {
		width: 240px;
	}
</style>
